package com.gzc.pm.resource
{
	import com.gzc.pm.events.ResourceEvent;
	
	import flash.events.EventDispatcher;

	[Event(name="resource_loading", type="com.gzc.pm.events.ResourceEvent")]
	public class BaseResource extends EventDispatcher
	{
		public function BaseResource()
		{
		}
		
		protected var _resTotalCount:int = 0;
		protected var _resLoaded:int = 0;
		protected var _urlPrefix:String;
		
		public function load(urlPrefix:String=''):void{
			_urlPrefix = urlPrefix;
		}
		
		protected function increaseLoaded():void{
			_resLoaded++;
			if(_resTotalCount){
				var resourceEvent:ResourceEvent = new ResourceEvent(ResourceEvent.RESOURCE_LOADING);
				resourceEvent.data = int(_resLoaded*100/_resTotalCount);
				dispatchEvent(resourceEvent);
			}
		}
		
	}
}